package unit7_Practice_5;

import java.util.ArrayList;
import java.util.List;

public class quzhishuThread extends Thread{
	int kaishifanwei;
	int jieshufanwei;
	int count;
	List<Integer> zhishushuzu = new ArrayList<Integer>();
	public quzhishuThread(int kaishifanwei,int jieshufanwei){
		this.kaishifanwei = kaishifanwei;
		this.jieshufanwei = jieshufanwei;
	}
	public Boolean shifouzhishu(int number){
		for(int i=2;i<number;i++ ){
			if(number%i==0){
				return false;
			}
		}
		return true;
		
	}
	public void run(){
		for(;kaishifanwei<jieshufanwei;kaishifanwei++){
			if(shifouzhishu(kaishifanwei)){
				count++;
				zhishushuzu.add(kaishifanwei);
			}
		}
		System.out.println(quzhishuThread.currentThread().getName()+"  "+count+"   "+zhishushuzu);
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		quzhishuThread thread1 = new quzhishuThread(2,100000);
		quzhishuThread thread2 = new quzhishuThread(100000,200000);
		thread1.start();
		thread2.start();
	}

}
